#!/bin/sh
if [ $# -eq 2 ]
then
    echo "***********************************"
    echo "*****Step1转换ape为wav*****"
    echo "***********************************"
    ffmpeg -i "$1" .temp.wav
    echo "***********************************"
    echo "*****Step2转换wav为mp3*****"
    echo "***********************************"
    lame -b 320  .temp.wav .temp.mp3
    echo "************************************"
    echo "*****Step3切分mp3文件*****"
    echo "************************************"
    enconv "$2"
    mp3splt .temp.mp3 -c "$2"
    rm .temp.wav .temp.mp3
    echo "******转换完成！****"
else if [ $# -eq 1 ] 
    then
        echo "***********************************"
        echo "*****Step1转换ape为wav*****"
        echo "***********************************"
        ffmpeg -i "$1" .temp.wav
        echo "***********************************"
        echo "*****Step2转换wav为mp3*****"
        echo "***********************************"
        lame -b 320  .temp.wav "$1".mp3
        rm .temp.wav
    else
        echo  "usage:ape2mp3 filename(ape) filename(cue)"
    fi
fi

## chmod +x ape2mp3
## ape2mp3 stefanie.ape stefanie.cue
